package com.awcall.iot.model;

import java.io.Serializable;

import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import java.io.Serializable;

/**
 * <p>
 * 角色-权限 关联表
 * </p>
 *
 * @author wuhui
 * @since 2018-03-05
 */
@TableName("bd_role_authority")
public class RoleAuthority extends Model<RoleAuthority> {

    private static final long serialVersionUID = 1L;

	@TableId(value="id", type= IdType.AUTO)
	private Integer id;
    /**
     * 角色名称
     */
	@TableField("role_id")
	private Integer roleId;
	@TableField("authority_id")
	private Integer authorityId;
	@TableField(value = "created_at", fill = FieldFill.INSERT)
	private Date createdAt;
	@TableField(value = "updated_at", fill = FieldFill.INSERT_UPDATE)
	private Date updatedAt;

	@TableField(exist = false)
	private Integer[] authorityIds;

	public Integer[] getAuthorityIds() {
		return authorityIds;
	}

	public RoleAuthority setAuthorityIds(Integer[] authorityIds) {
		this.authorityIds = authorityIds;
		return this;
	}

	public Integer getId() {
		return id;
	}

	public RoleAuthority setId(Integer id) {
		this.id = id;
		return this;
	}

	public Integer getRoleId() {
		return roleId;
	}

	public RoleAuthority setRoleId(Integer roleId) {
		this.roleId = roleId;
		return this;
	}

	public Integer getAuthorityId() {
		return authorityId;
	}

	public RoleAuthority setAuthorityId(Integer authorityId) {
		this.authorityId = authorityId;
		return this;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public RoleAuthority setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
		return this;
	}

	public Date getUpdatedAt() {
		return updatedAt;
	}

	public RoleAuthority setUpdatedAt(Date updatedAt) {
		this.updatedAt = updatedAt;
		return this;
	}

	public static final String ID = "id";

	public static final String ROLE_ID = "role_id";

	public static final String AUTHORITY_ID = "authority_id";

	public static final String CREATED_AT = "created_at";

	public static final String UPDATED_AT = "updated_at";

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

	@Override
	public String toString() {
		return "RoleAuthority{" +
			", id=" + id +
			", roleId=" + roleId +
			", authorityId=" + authorityId +
			", createdAt=" + createdAt +
			", updatedAt=" + updatedAt +
			"}";
	}
}
